package com.ctshk.sapp.air.controller;

import com.ctshk.common.annotations.OperationLogAnnotation;
import com.ctshk.common.dto.Result;
import com.ctshk.common.enums.OperationLogModel;
import com.ctshk.common.enums.OperationLogType;
import com.ctshk.common.web.support.BaseController;
import com.ctshk.rpc.air.req.AirInitializationSettingsDataReq;
import com.ctshk.rpc.air.req.AirInitializationSettingsQueryReq;
import com.ctshk.rpc.air.service.IAirInitializationSettingsService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;

/**
 * <p>
 * 机票api初始化设置表 前端控制器
 * </p>
 *
 * @author lihang
 * @since 2021-03-05
 */
@Api(value = "机票初始化API加幅",tags = "机票初始化API加幅")
@RestController
@RequestMapping("/air-initialization-settings")
public class AirInitializationSettingsController extends BaseController {


    @DubboReference
    private IAirInitializationSettingsService iAirInitializationSettingsService;

    @ApiOperation(value = "修改机票API加幅,没有则新增", notes = "修改机票API加幅,没有则新增")
    @OperationLogAnnotation(operModul = OperationLogModel.TICKET, operType = OperationLogType.UPDATE, operTitle = "修改机票API加幅,没有则新增", operDesc = "修改机票API加幅,没有则新增")
    @PostMapping("/update")
    public Result update(@RequestBody @Valid AirInitializationSettingsDataReq req){
        return  iAirInitializationSettingsService.update(req,getCurrentUser(getRequest()));
    }

    @ApiOperation(value = "查询已经存在的机票API加幅信息", notes = "查询已经存在的机票API加幅信息")
    @OperationLogAnnotation(operModul = OperationLogModel.TICKET, operType = OperationLogType.QUERY, operTitle = "查询已经存在的机票API加幅信息", operDesc = "查询已经存在的机票API加幅信息")
    @PostMapping("/query")
    public Result query(@RequestBody AirInitializationSettingsQueryReq req){
        return  iAirInitializationSettingsService.query(req);
    }


}
